package cn.hjc.dao;

import cn.hjc.entity.User;

import java.io.Serializable;

public class UserDao extends BaseDao{
    public User get(Serializable id){
        //通过Session的get()方法根据OID加载指定对象
        return (User) HibernateUtil.currentSession().get(User.class,id);

    }
    public User load(Serializable id){
        //通过Session的load()方法根据OID加载指定对象
        return (User) HibernateUtil.currentSession().load(User.class,id);
    }

    public void save(User user){
        currentSession().save(user);//保存指定的Dept

    }

    public void delete(User user){
        currentSession().delete(user);  //删除指定的Dept对象
    }

    public User merge(User user){
        return  (User) currentSession().merge(user);
    }
}
